package com.atguigu.schedule.config;

import com.atguigu.schedule.service.YOLOApiManager;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;

/**
 * YOLO API配置类
 * 负责初始化和清理YOLO API管理器
 */
@Slf4j
@Configuration
@RequiredArgsConstructor
public class YOLOApiConfig {
    
    private final YOLOApiManager yoloApiManager;
    
    /**
     * 初始化YOLO API管理器
     */
    @PostConstruct
    public void initializeYOLOApi() {
        log.info("🚀 初始化YOLO API配置...");
        yoloApiManager.initialize();
        log.info("✅ YOLO API配置初始化完成");
    }
    
    /**
     * 清理YOLO API管理器资源
     */
    @PreDestroy
    public void cleanupYOLOApi() {
        log.info("🧹 清理YOLO API配置...");
        yoloApiManager.cleanup();
        log.info("✅ YOLO API配置清理完成");
    }
}
